#ifndef __IASSISTGEN2_UIMODULE_H
#define __IASSISTGEN2_UIMODULE_H

#pragma once

#include "UIModule.h"
#include "UIModuleDef.h"
#include "UIEvent.h"
#include "UIConfigResourceManager.h"
#include "UIEventRouter.h"
#include "UILogger.h"

class UIEventRouter;

class UIModule
{
public:
	UIModule(UIModuleType type);
	virtual ~UIModule(void);

	virtual bool processSyncEvent(UIEvent* event) = 0;
	virtual bool processAsyncEvent(UIEvent* event) = 0;
	virtual bool processData(UIEvent* event) = 0;
	virtual bool cancel() = 0;

	/** Overloaded FATAL Logging mode with reference calling object name*/
	void fatal(std::string className, std::string message)
	{
		if (m_pLogger)
			m_pLogger->fatal(m_type, className, message);
	};

	/** Overloaded WARN Logging mode with reference calling object name*/
	void warn(std::string className, std::string message)
	{
		if (m_pLogger)
			m_pLogger->warn(m_type, className, message);
	};

	/** Overloaded INF Logging mode with reference calling object name*/
	void inf(std::string className, std::string message)
	{
		if (m_pLogger)
			m_pLogger->inf(m_type, className, message);
	};

	/** Overloaded ERR Logging mode with reference calling object name*/
	void err(std::string className, std::string message)
	{
		if (m_pLogger)
			m_pLogger->err(m_type, className, message);
	};

	/** Overloaded DEBUG Logging mode with reference calling object name*/
	void debug(std::string className, std::string message)
	{
		if (m_pLogger)
			m_pLogger->debug(m_type, className, message);
	};

	const UIModuleType getType() const {
		return m_type;
	}

	bool sendEvent(UIEvent* event);
	bool sendSyncEvent(UIEvent* event, UIEvent& retEvent, int timeOutSecond);
	bool sendData(UIEvent* event);

protected:
	UIModuleType	m_type;
	UIEventRouter*				m_pRouter;
	UILogger*					m_pLogger;
	UIConfigResourceManager*	m_pConfigurator;
};

#endif
